strptime(buff, "%d%m%y%H%M%S", &tm);
int millisecs = (int) time % 1000;
wpt->SetCreationTime(mkgmtime(&tm), millisecs);
-// FIXME: this is papering over a problem somewhere...
-wpt->microseconds = millisecs * 1000;
if (wpt->fix > 0) {
wpt->fix = (fix_type)(wpt->fix + 1);
}
snprintf(buf, sizeof(buf), "%02d:%02d:%02d", tm.tm_hour, tm.tm_min, tm.tm_sec);
- if (wpt->microseconds > 0) {
- int len = 6;
- int ms = wpt->microseconds;
+ int millisecs = wpt->GetCreationTime().msec();
+ if (millisecs > 0) {
+ int len = 3;
- while (len && (ms % 10 == 0)) {
- ms /= 10;
+ while (len && (millisecs % 10 == 0)) {
+ millisecs /= 10;
len--;
}
- snprintf(msec, sizeof(msec), ".%0*d", len, ms);
+ snprintf(msec, sizeof(msec), ".%0*d", len, millisecs);
strcat(buf, msec);
}
gbfprintf(fout, "%s%s", unicsv_fieldsep, buf);
if (wpt->creation_time <= 0) {
return (double) 0;
} else {
- return ((double)wpt->creation_time + ((double)wpt->microseconds / 1000000));
+
+ return ((double)wpt->creation_time + ((double)wpt->creation_time.msec() / 1000));
}
}